use std::fs;

mod lib;

fn main() {
    println!("Start modifies");

    // /*
    let mut names = lib::list_files_with_ext("./", "md");
    println!("Count: {}", names.len());
    while let Some(name) = names.pop() {
        println!("{}", name);
        let r = lib::read_file(&name).unwrap();
        println!("{}", r);
        let p = lib::replace_crlf_to_lf(&r);
        println!("{}", p);
        let o = fs::write(&name, p);
        match o {
            Ok(file) => file,
            Err(error) => {
                panic!("There was a problem opening the file: {:?}", error)
            },
        };
    }
    println!("Count: {}", names.len());
    // */
}
